import org.apache.spark.SparkConf;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;

/**
 * @author yhm
 * @create 2022-06-16 16:07
 */
public class SparkSQL {
    public static void main(String[] args) {

        SparkConf conf = new SparkConf().setMaster("local[*]").setAppName("sparkSQL");

        SparkSession sparkSession = SparkSession.builder().enableHiveSupport().config(conf).getOrCreate();

//        sparkSession.sql("select * from user");
        Dataset<Row> json = sparkSession.read().json("input");
        json.show();

        sparkSession.close();
    }
}
